//
//  XWSegmentedControl.h
//  CELSP
//  选项栏控件

//  Created by wzl on 16/6/2.
//  Copyright © 2016年 hq88. All rights reserved.
//

#import <UIKit/UIKit.h>

@class XWSegmentedControl;
@protocol XWSegmentedControlDelegate <NSObject>
@optional
- (void)segmentedControl:(XWSegmentedControl*)segmentedControl didSelectSegmentIndex:(NSInteger)segmentIndex;
@end

typedef enum : NSUInteger {
    XWSegmentedControlLineStyleDefault, //默认XWSegmentedControlLineStyleEqualWidth
    XWSegmentedControlLineStyleEqualWidth,//各个线条宽度相等
    XWSegmentedControlLineStyleEqualTitle//与标题文字所占的宽度相等
} XWSegmentedControlLineStyle;//线条样式控制

@interface XWSegmentedControl : UIView
/** 标题数组 */
@property (nonatomic,strong) NSArray* titles ;
/** 视图数组 */
@property (nonatomic,strong) NSArray* views ;
@property (nonatomic,weak) id<XWSegmentedControlDelegate> delegate ;
@property (nonatomic,assign) NSInteger selectSegmentIndex;
@property (nonatomic,strong) UIColor* selectLineColor ;//选中线条颜色
@property (nonatomic,strong) UIColor* normalLineColor ;//常规线条颜色
@property (nonatomic,assign) CGFloat lineWidth;//线粗
@property (nonatomic,assign) XWSegmentedControlLineStyle lineStyle;
@property (nonatomic,assign) BOOL isHasTitleBottomLine;// title底部是否有横线（默认有）
@property (nonatomic,assign) BOOL isHasTitleCenterLine;// title之间是否有中线分隔（默认无）
/**
 设置选中和未选中文字颜色
 
 @param attributes 文字属性
 @param state      状态
 */
- (void)setTitleTextAttributes:(NSDictionary*)attributes forState:(UIControlState)state;


/**
 *  设置选项栏的标题和视图
 *
 *  @param titles 标题数组
 *  @param views  视图数组
 */
- (void)setSegmentedControlTitles:(NSArray*)titles andViews:(NSArray*)views;

/**
 *  设置选项栏的标题
 *
 *  @param title   标题内容
 *  @param segment 标题序号(0,1....)
 */
- (void)setTitle:(NSString *)title forSegmentAtIndex:(NSUInteger)segment;
@end
